import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import index from '@/page/index/index'
import swipeDetail from '@/page/swipeDetail/swipeDetail'
import shop from '@/page/shop/shop'
import user from '@/page/user/user'
import school from '@/page/school/school'
import orderPay from '@/page/orderPay/orderPay'
import goodsDetail from '@/page/goodsDetail/goodsDetail'
import cart from '@/page/cart/cart'
import order from '@/page/order/order'
import addAddress from '@/page/address/addAddress'
import address from '@/page/address/address'
import search from '@/page/search/search'
import goods from '@/page/goods/goods'
import child from '@/page/child/child'
import addChild from '@/page/child/addChild'
import pay from '@/page/pay/pay'
Vue.use(Router)

export default new Router({
  // 如打包文件存放在Tomcat/webapps/web，那么base就这么写
  base: '/web/',
  routes: [
    {
      path: '/',
      name: 'index',
      component: index,
      meta: {
        isIndex:true,
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/swipeDetail',
      name: 'swipeDetail',
      component: swipeDetail,
      meta: {
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/shop',
      name: 'shop',
      component: shop,
      meta: {
        isIndex:true,
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/cart',
      name: 'cart',
      component: cart,
      meta: {
        isIndex:true,
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/user',
      name: 'user',
      component: user,
      meta: {
        isIndex:true,
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/school',
      name: 'school',
      component: school
    },
    {
      path: '/orderPay',
      name: 'orderPay',
      component: orderPay,
      meta: {
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/goodsDetail',
      name: 'goodsDetail',
      component: goodsDetail
    },
    {
      path: '/order',
      name: 'order',
      component: order
    },
    {
      path: '/addAddress',
      name: 'addAddress',
      component: addAddress,
      meta: {
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/address',
      name: 'address',
      component: address,
      meta: {
        keepAlive: true // true将组件在内存中进行‘持久化’
      }
    },
    {
      path: '/search',
      name: 'search',
      component: search
    },
    {
      path: '/goods',
      name: 'goods',
      component: goods
    },
    {
      path: '/child',
      name: 'child',
      component: child
    },
    {
      path: '/addChild',
      name: 'addChild',
      component: addChild
    },
    {
      path: '/pay',
      name: 'pay',
      component: pay
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return {x: 0, y: 0}
  }
})
